package com.kyzh.core.utils

import android.content.Context
import android.graphics.Bitmap
import android.net.Uri
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.huantansheng.easyphotos.engine.ImageEngine

object GlideEngine : ImageEngine {
    override fun getCacheBitmap(context: Context, uri: Uri, width: Int, height: Int): Bitmap? {
                return Glide.with(context).asBitmap().load(uri).submit(width, height).get()

    }

    override fun loadPhoto(context: Context, uri: Uri, imageView: ImageView) {
        Glide.with(context).load(uri).into(imageView)
    }

    override fun loadGifAsBitmap(context: Context, gifUri: Uri, imageView: ImageView) {
        Glide.with(context).asBitmap().load(gifUri).into(imageView)
    }

    override fun loadGif(context: Context, gifUri: Uri, imageView: ImageView) {
        Glide.with(context).asGif().load(gifUri).into(imageView)
    }


}